﻿<%@ Page Language="C#" MasterPageFile="~/MasterPageMcSigAdmin.master" AutoEventWireup="true" CodeFile="CDPs.aspx.cs" Inherits="CDPs" Title="Untitled Page" %>


<%@ Register Assembly="eWorld.UI" Namespace="eWorld.UI" TagPrefix="ew" %>
<%@ Register Assembly="Anthem" Namespace="Anthem" TagPrefix="anthem" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="UsrControls" Namespace="UsrControls" TagPrefix="cc1" %>
<%@ Register assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView.Export" tagprefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script language="javascript" type="text/javascript">
    function OnGridSelectionChanged() {
    var counter = document.getElementById("selCount");
    if(counter != null) 
    setInnerText(counter, ctl00_ContentPlaceHolder1_ASPxGridViewCDPs.GetSelectedRowCount().toString());
    ctl00_ContentPlaceHolder1_ASPxGridViewCDPs.GetSelectedFieldValues('FPR_ENTIDAD_TERRITORIAL_COFINANCION', OnGridSelectionComplete);
}
function OnGridSelectionComplete(values) {
    selList.BeginUpdate();
    selList.ClearItems();
    for(var i = 0; i < values.length; i ++) {
        selList.AddItem(values[i]);
    }
    selList.EndUpdate();
}
function setInnerText(element, text) { 
    if(typeof element.textContent != 'undefined') { 
        element.textContent = text; 
    } 
    else if (typeof element.innerText != 'undefined') { 
        element.innerText = text; 
    } 
    else if (typeof element.removeChild != 'undefined') { 
        while (element.hasChildNodes()) { 
            element.removeChild(element.lastChild); 
        } 
        element.appendChild(document.createTextNode(text)); 
    } 
}

function confirmEdit()
{
var counter = ctl00_ContentPlaceHolder1_ASPxGridViewCDPs.GetSelectedRowCount();

if (counter > 1)
    {
    counter = 0;
        alert("Debe seleccionar un solo registro");
        return(false);
    }
    else if (counter == 1)
    {
    counter = 0;
        return(true);
    }
    else if (counter == 0)
    {
    counter = 0;
    alert("Debe seleccionar al  menos un registro");
        return(false);
    }
}
function delete_PreCallBack(button) 
{
var counter = ctl00_ContentPlaceHolder1_ASPxGridViewCDPs.GetSelectedRowCount();

if (counter > 0)
    {
        return confirm ('Esta seguro de eliminar los registros seleccionados?')
    }
  alert("Debe seleccionar por lo menos un registro");
    return(false);
  
}

function confirmDelete () 
{ 
		var frm;
		
		if (arguments.length > 0)
		{
			frm = arguments[0];
		}
		else
		{
			frm =document.forms[0];
		}



    // loop through all elements
    for (i=0; i<frm.length; i++) 
    {
        // Look for our checkboxes only
        if (frm.elements[i].name.indexOf("chkId") !=-1) 
        {
            // If any are checked then confirm alert, otherwise nothing happens
            if(frm.elements[i].checked) 
            {
                return confirm ('Esta seguro de eliminar los registros seleccionados?')
            }
        }
    }
    alert("Debe seleccionar por lo menos un registro");
    return(false);
}
    </script>
<h1 class="contratos">CDPs</h1>
<anthem:ValidationSummary ID="ValidationSummary1" runat="server" AutoUpdateAfterCallBack="True" />
                <anthem:Label ID="lblMensaje" runat="server" AutoUpdateAfterCallBack="True" UpdateAfterCallBack="True"></anthem:Label>
        <p class="bt-space10">
                <asp:Label ID="lblInstruccion" runat="server" Text="Para agregar un CDP, por favor selccionelo y a  continuación pulse sobre el botón Guardar."
                    CssClass="instruccion"></asp:Label></p>
       
            <div class="toolbar">
                <asp:ImageButton ID="btnRegresar" CssClass="regresar" runat="server" CausesValidation="False" ImageUrl="~/Imagenes/bt-regresar.gif"
                    OnClick="btnRegresar_Click" />
                <cc1:WccAcciones ID="WccAcciones1" runat="server" AddCausesValidation="True" AddEnableCallBack="True"
                    ArchiveVisible="False" AuditVisible="False" DeclineVisible="False" DeleteEnableCallBack="True" PublishVisible="False" UpdateCausesValidation="True"
                    UpdateEnableCallBack="True" UpdateAutoUpdateAfterCallBack="true" ValidateVisible="False"
                    AddAutoUpdateAfterCallBack="True" DeleteAutoUpdateAfterCallBack="True" OnAdd_OnClick="WccAcciones1_Add_OnClick" UpdatePreCallBackFunction="return confirmEdit();" AddPreCallBackFunction="return confirmEdit();" />
            </div>
        
                
                <anthem:Panel ID="Panel1" runat="server" AutoUpdateAfterCallBack = true Width="100%">
                <div class="overflow">
                <dxwgv:ASPxGridView ID="ASPxGridViewCDPs" runat="server" AutoGenerateColumns="False"
                    CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css" CssPostfix="PlasticBlue"
                    Width="100%" KeyFieldName="FAE_ID" Theme="PlasticBlue">
                    <Images SpriteCssFilePath="~/App_Themes/PlasticBlue/{0}/sprite.css">
                        <LoadingPanelOnStatusBar Url="~/App_Themes/PlasticBlue/GridView/gvLoadingOnStatusBar.gif">
                        </LoadingPanelOnStatusBar>
                        <LoadingPanel Url="~/App_Themes/PlasticBlue/GridView/Loading.gif">
                        </LoadingPanel>
                    </Images>
                    <Styles CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css" CssPostfix="PlasticBlue">
                        <Header ImageSpacing="10px" SortingImageSpacing="10px">
                        </Header>
                    </Styles>
                    <Columns>
                    <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                            <ClearFilterButton Visible="True">
                            </ClearFilterButton>
                        </dxwgv:GridViewCommandColumn>
                        <dxwgv:GridViewDataTextColumn FieldName="FAE_ID" VisibleIndex="1" Visible="False">
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn Caption="N&#250;mero CDP" FieldName="FAE_NUMERO_CDP"
                            VisibleIndex="1">
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn Caption="Valor CDP" FieldName="FAE_VALOR_CDP" VisibleIndex="2">
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn Caption="Objeto" FieldName="FAE_OBJETO" VisibleIndex="3">
                        </dxwgv:GridViewDataTextColumn>
                    </Columns>
                    <Settings ShowFilterRow="True" ShowFilterRowMenu="True" />
                    <SettingsPager ShowDefaultImages="False">
                        <AllButton Text="All">
                        </AllButton>
                        <NextPageButton Text="Next &gt;">
                        </NextPageButton>
                        <PrevPageButton Text="&lt; Prev">
                        </PrevPageButton>
                    </SettingsPager>
                    
                    <StylesEditors>
                        <CalendarHeader Spacing="11px">
                        </CalendarHeader>
                        <ProgressBar Height="25px">
                        </ProgressBar>
                    </StylesEditors>
                </dxwgv:ASPxGridView>
                </div>
                
                </anthem:Panel>
                <dx:aspxgridviewexporter id="ASPxGridViewExporter1" runat="server" gridviewid="ASPxGridViewCDPs"></dx:aspxgridviewexporter>
                <asp:Button ID="btnExportar" runat="server" OnClick="btnExportar_Click" Text="Exportar Excel" CssClass="button m tp-space10" />      
</asp:Content>

